package com.weipai.springboot.module.dao;

import com.weipai.springboot.model.*;

import java.util.List;
import java.util.Map;

public interface OrderDao {
    /**
     * 管理后台根据订单编号,订单状态,时间区间查询订单分页列表
     *
     * @param startTime
     * @param endTime
     * @param start
     * @param size
     * @return
     */
    List<Map<String, Object>> getOrderList(String shopId,
                                           String customerId,
                                           Integer status,
                                           String orderNumber,
                                           String startTime,
                                           String endTime,
                                           Integer start,
                                           Integer size,
                                           String keyword,
                                           Integer modeOfPayment);

    /**
     * 管理后台根据订单编号,订单状态,时间区间查询订单分页列表 计数
     *
     * @param startTime
     * @param endTime
     * @return
     */
    Integer countOrderList(String shopId, String customerId, Integer status, String orderNumber, String startTime, String endTime);

    Integer update(Order order);

    List<Map<String, Object>> getOrderSublist(String orderNumber);

    int deleteOrder(String orderNumber);

    List<Map<String, Object>> getOrderCountList(String time);

    int insertOrder(Order order);

    int insertSubOrderList(List<OrderSublist> sublist);

    //根据订单号查询订单
    Map<String, Object> getOrderInfoByOrderNumber(String orderNumber);

    //保存退货申请
    int saveSaleReturn(SaleReturn saleReturn);

    //获取换货界面的商品信息、地址信息
    Map<String, Object> getOrderInfoByOrderNumberAndGoodsId(String orderNumber, String goodsId);

    //审核货订退单
    int auditReturnOrder(String auditUserId, String saleReturnNumber, Integer isAudit);

    //更改退货订单的状态
    int updateSaleReturnStatus(String userId, String saleReturnNumber, int status);

    //保存换货申请
    int saveExchange(Exchange exchange);

    //换货申请的审核
    int auditExchange(String auditUserId, String exchangeNumber, Integer isAudit);

    //更改换货订单的状态
    int changeExchangeStatus(String userId, String exchangeNumber, Integer status);

    //获得用户全部的子订单
    List<Map<String, Object>> orderSublistByCustomerId(String customerId, Integer start, Integer size, Integer isAfterSale);

    //获得用户全部子订单的数量
    Integer orderSublistByCustomerIdAmount(String customerId, Integer isAfterSale);

    //点击售后申请跳转选择售后类型页面
    Map<String, Object> afterSaleTypeInfo(String orderSublistId);

    //确认发货
    int confirmDelivery(String orderNumber, String logisticsCompany, String trackingNumber);

    //获取子订单中的基本信息
    List<Map<String, Object>> getSublistByOrderNumber(String orderNumber);

    //批量保存出库明细
    int saveInventoryOutList(List<InventoryOut> outList);

    //更改支付状态
    int updatePaymentAndStatus(String orderNumber, Integer payment, int orderStatus, int paymentStatus);

    //查询总共的交易金额
    Integer getAllRealPay(String startTime, String endTime);

    //按月份和订单状态分组查出交易金额
    List<Map<String, Object>> orderStatement(String time);

    //某一时间段的退款金额
    Integer getSaleReturnRealPay(String time);

    int getOrderByShopId(String shopId);

    Integer getSaleReturnRealPayByShopId(String shopId);

    //查询用户的下单金额和交易成功的金额
    Map<String, Object> getOrderAmountByCustomerId(String customerId, int status);

    //查询用户的退货金额和退货金额
    Map<String, Object> getSaleReturnAmountByCustomerId(String customerId);

    //查询退货订单
    List<Map<String, Object>> getSaleReturnList(Integer isAudit, Integer start, Integer size, String search,
                                                String shopId, String startTime, String endTime);

    //查询退货订单数量
    int getSaleReturnAmount(Integer isAudit, String search, String shopId, String startTime, String endTime);

    //查询换货订单
    List<Map<String, Object>> getExchangeList(Integer isAudit, Integer start, Integer size, String search,
                                              String shopId, String startTime, String endTime);

    //查询换货订单的数量
    int getExchangeListAmount(Integer isAudit, String search, String shopId, String startTime, String endTime);

    //根据退货单号查询退货订单
    SaleReturn getSaleReturnBySaleReturnNumber(String saleReturnNumber);

    //根据订单号获得子订单的信息
    List<Map<String, Object>> getSublist(String orderNumber);

    //物理删除订单
    int deleteByPrimaryKey(String orderId);

    //物理删除子订单
    int deleteSublistByOrderNumber(String orderId);

    //查询此订单是否是信誉值支付的退货订单
    Map<String, Object> getSaleReturnBySaleReturnNumberAndPayment(String saleReturnNumber, Integer modeOfPayment);

    //更改订单的状态
    int changeOrderStatus(String orderNumber, int status);

    Order getOrderInfoByOrderNumber22(String orderNumber);

    int updateByPrimaryKeySelective(Order order1);

    //更改订单状态为交易成功
    int updateOrderStatus(String orderNumber, int status);

    //根据状态查询订单
    List<Map<String, Object>> getOrderListByOrderStatus(int status);

    //通过订单号查询此订单是否产生了员工收益
    EmployeeIncome getEmployeeIncomeByOrderNumber(String orderNumber);

    //查询用户订单每条订单退款金额
    List<Map<String, Object>> getOrderByMoney(String customerId);
}
